package net.mysoft.budgetsoft.system.domain;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**   
 *  
 * @author dagongPGP v1.0 
 * @link <a href=http://www.dagongsoft.net>北京大公信软科技有限公司</a> 
 *  
 * @version $Revision: 1.00  $Date: 2013-07-08 17:25:41 
 */
//@Entity
//@Table(name="Flow")
public class TFlow implements java.io.Serializable {
	public static final int STATUS_NOT_STARTED=0;//未启动
	public static final int STATUS_UNFINISHED=1;//未完成
	public static final int STATUS_FINISH=2;//完成
	public static final int STATUS_PAUSE=10;//暂停
	
	public static final int RESULT_SEND_BACK=0;//退回
	public static final int RESULT_PASS=1;//通过
	
    private String flo_ID;
    private Integer flo_Status;
    private TFlowTemplate flowTemplate;
    private String flo_CurrNode;
    private java.util.Date flo_LastUpDateTime;
    private String flo_Creator;
    private java.util.Date flo_CreateTime;
    private Set<TFlowTaskNode> floeTaskNodeSet;
    
    private String xiangMuJBXXBH;
    private String flo_OperationNote;
	@Id 
	@GeneratedValue(generator = "IDGenerator")
	@GenericGenerator(name = "IDGenerator", strategy = "net.mysoft.framework.util.IDGenerator", 
			parameters = { @Parameter(value = "SEQ_FLO", name = "seq")})
    @Column(name="FLO_ID", unique=true, nullable=false)
    public String getFlo_ID(){
    	return this.flo_ID;
    }
    
    public void setFlo_ID(String flo_ID){
    	this.flo_ID = flo_ID;
    }
    @Column(name="FLO_OperationNote")
    public String getFlo_OperationNote() {
		return flo_OperationNote;
	}

	public void setFlo_OperationNote(String flo_OperationNote) {
		this.flo_OperationNote = flo_OperationNote;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy="flow")
	public Set<TFlowTaskNode> getFloeTaskNodeSet() {
		return floeTaskNodeSet;
	}

	public void setFloeTaskNodeSet(Set<TFlowTaskNode> floeTaskNodeSet) {
		this.floeTaskNodeSet = floeTaskNodeSet;
	}

	@Column(name="XiangMuJBXXBH")
    public String getXiangMuJBXXBH() {
		return xiangMuJBXXBH;
	}

	public void setXiangMuJBXXBH(String xiangMuJBXXBH) {
		this.xiangMuJBXXBH = xiangMuJBXXBH;
	}

	@Column(name="FLO_Status")
    public Integer getFlo_Status(){
    	return this.flo_Status;
    }
    
    public void setFlo_Status(Integer flo_Status){
    	this.flo_Status = flo_Status;
    }
    
    @ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "FLO_TemplateID")
	public TFlowTemplate getFlowTemplate() {
		return flowTemplate;
	}

	public void setFlowTemplate(TFlowTemplate flowTemplate) {
		this.flowTemplate = flowTemplate;
	}

    @Column(name="FLO_CurrNode")
    public String getFlo_CurrNode(){
    	return this.flo_CurrNode;
    }

	public void setFlo_CurrNode(String flo_CurrNode){
    	this.flo_CurrNode = flo_CurrNode;
    }
    
    @Column(name="FLO_LastUpDateTime")
    public java.util.Date getFlo_LastUpDateTime(){
    	return this.flo_LastUpDateTime;
    }
    
    public void setFlo_LastUpDateTime(java.util.Date fLO_LastUpDateTime){
    	this.flo_LastUpDateTime = fLO_LastUpDateTime;
    }
    
    @Column(name="FLO_Creator")
    public String getFlo_Creator(){
    	return this.flo_Creator;
    }
    
    public void setFlo_Creator(String fLO_Creator){
    	this.flo_Creator = fLO_Creator;
    }
    
    @Column(name="FLO_CreateTime")
    public java.util.Date getFlo_CreateTime(){
    	return this.flo_CreateTime;
    }
    
    public void setFlo_CreateTime(java.util.Date fLO_CreateTime){
    	this.flo_CreateTime = fLO_CreateTime;
    }
    
	
    @Override
    public int hashCode() {
    	int prime = 0;
        prime +=this.getFlo_ID().hashCode();
        return prime;
    }

    @Override
    public boolean equals(Object obj) {
    	boolean isEquals = false;
    	if(obj!=null&&this.getClass()==obj.getClass()){
    		TFlow clazz = (TFlow)obj;
            if(clazz.getFlo_ID().equals(this.getFlo_ID()))
            	isEquals = true;
    		return isEquals;
    	}
        return isEquals;
    }

}